package com.edu.controller;

import com.edu.bean.Book;
import com.edu.bean.Writer;
import com.edu.service.BookService;
import com.edu.service.WriterService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author:何包蛋
 * @Date :2022/11/20 - 11 - 20 - 16:48
 */
@Controller
public class WriterController {

    @Resource
    private WriterService writerService;

    @GetMapping("/writer/{writerid}")
    public String getWriterById(@PathVariable("writerid") int writerid , Model model){
        Writer writer = writerService.getWriterById(writerid);
        model.addAttribute("writer",writer);
        return "/writer.jsp";
    }
}
